package domain.entities;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import javax.persistence.*;
import java.util.*;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * ComiteDocencia entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "comite_docencia", catalog = "bms")
public class ComiteDocencia implements java.io.Serializable {

	// Fields

	private Integer id;
	private Address address;
	private Centro centro;
	private String agreeReceivingDirectlyFromSponsor;
	private String documentApprovalDelay;
	private String howOftenTheyMet;
	private String listOfMembersNotParticipating;
	private String listOfMembersParticipating;
	private String name;
	private String needEcapproval;
	private Date nextMeeting;
	private String timelineToSubmit;
	private Collection<ContactPerson> contactPersons = new ArrayList<ContactPerson>(0);
	private Set<RequerimientosComite> requerimientosComites = new HashSet<RequerimientosComite>(
			0);

	// Constructors

	/** default constructor */
	public ComiteDocencia() {
	}

	/** minimal constructor */
	public ComiteDocencia(Address address, Centro centro) {
		this.address = address;
		this.centro = centro;
	}

	/** full constructor */
	public ComiteDocencia(Address address, Centro centro,
			String agreeReceivingDirectlyFromSponsor,
			String documentApprovalDelay, String howOftenTheyMet,
			String listOfMembersNotParticipating,
			String listOfMembersParticipating, String name,
			String needEcapproval, Date nextMeeting, String timelineToSubmit,
			Set<ContactPerson> contactPersons,
			Set<RequerimientosComite> requerimientosComites) {
		this.address = address;
		this.centro = centro;
		this.agreeReceivingDirectlyFromSponsor = agreeReceivingDirectlyFromSponsor;
		this.documentApprovalDelay = documentApprovalDelay;
		this.howOftenTheyMet = howOftenTheyMet;
		this.listOfMembersNotParticipating = listOfMembersNotParticipating;
		this.listOfMembersParticipating = listOfMembersParticipating;
		this.name = name;
		this.needEcapproval = needEcapproval;
		this.nextMeeting = nextMeeting;
		this.timelineToSubmit = timelineToSubmit;
		this.contactPersons = contactPersons;
		this.requerimientosComites = requerimientosComites;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

    @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@JoinColumn(name = "ADDRESSid", nullable = false)
	public Address getAddress() {
		return this.address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "CENTROid", nullable = true)
	public Centro getCentro() {
		return this.centro;
	}

	public void setCentro(Centro centro) {
		this.centro = centro;
	}

	@Column(name = "agreeReceivingDirectlyFromSponsor")
	public String getAgreeReceivingDirectlyFromSponsor() {
		return this.agreeReceivingDirectlyFromSponsor;
	}

	public void setAgreeReceivingDirectlyFromSponsor(
			String agreeReceivingDirectlyFromSponsor) {
		this.agreeReceivingDirectlyFromSponsor = agreeReceivingDirectlyFromSponsor;
	}

	@Column(name = "documentApprovalDelay")
	public String getDocumentApprovalDelay() {
		return this.documentApprovalDelay;
	}

	public void setDocumentApprovalDelay(String documentApprovalDelay) {
		this.documentApprovalDelay = documentApprovalDelay;
	}

	@Column(name = "howOftenTheyMet")
	public String getHowOftenTheyMet() {
		return this.howOftenTheyMet;
	}

	public void setHowOftenTheyMet(String howOftenTheyMet) {
		this.howOftenTheyMet = howOftenTheyMet;
	}

	@Column(name = "listOfMembersNotParticipating")
	public String getListOfMembersNotParticipating() {
		return this.listOfMembersNotParticipating;
	}

	public void setListOfMembersNotParticipating(
			String listOfMembersNotParticipating) {
		this.listOfMembersNotParticipating = listOfMembersNotParticipating;
	}

	@Column(name = "listOfMembersParticipating")
	public String getListOfMembersParticipating() {
		return this.listOfMembersParticipating;
	}

	public void setListOfMembersParticipating(String listOfMembersParticipating) {
		this.listOfMembersParticipating = listOfMembersParticipating;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "needECApproval")
	public String getNeedEcapproval() {
		return this.needEcapproval;
	}

	public void setNeedEcapproval(String needEcapproval) {
		this.needEcapproval = needEcapproval;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "nextMeeting", length = 10)
	public Date getNextMeeting() {
		return this.nextMeeting;
	}

	public void setNextMeeting(Date nextMeeting) {
		this.nextMeeting = nextMeeting;
	}

	@Column(name = "timelineToSubmit")
	public String getTimelineToSubmit() {
		return this.timelineToSubmit;
	}

	public void setTimelineToSubmit(String timelineToSubmit) {
		this.timelineToSubmit = timelineToSubmit;
	}

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "comiteDocencia")
    @LazyCollection(LazyCollectionOption.FALSE)
    public Collection<ContactPerson> getContactPersons() {
		return this.contactPersons;
	}

    public void setContactPersons(Collection<ContactPerson> contactPersons) {
        this.contactPersons = contactPersons;
    }

    public void setContactPersons(Set<ContactPerson> contactPersons) {
		this.contactPersons = contactPersons;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "comiteDocencia")
	public Set<RequerimientosComite> getRequerimientosComites() {
		return this.requerimientosComites;
	}

	public void setRequerimientosComites(
			Set<RequerimientosComite> requerimientosComites) {
		this.requerimientosComites = requerimientosComites;
	}

}